<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

$btn_close = '<button data-dismiss="alert" class="close">&times;</button>';

/**
 * Page Header
 *
 * Load header for the page
 */
if (!function_exists('load_header')) {

    function load_header() {
        $CI = & get_instance();
        $main_dir = 'public/';
        if ($CI->uri->segment(1) == PANEL_URL) {
            $main_dir = 'panel/';
        }

        echo $CI->load->view($main_dir . 'layout/header');
    }

}

// ------------------------------------------------------------------------

/**
 * Page Content Footer
 *
 * Load content footer for the page
 */
if (!function_exists('load_content_footer')) {

    function load_content_footer() {
        $CI = & get_instance();
        $main_dir = 'public/';
        if ($CI->uri->segment(1) == PANEL_URL) {
            $main_dir = 'panel/';
        }

        echo $CI->load->view($main_dir . 'layout/content_footer');
    }

}

// ------------------------------------------------------------------------

/**
 * Page Content Footer
 *
 * Load content footer for the page
 */
if (!function_exists('load_navigator')) {

    function load_navigator() {
        $CI = & get_instance();
        $main_dir = 'public/';
        if ($CI->uri->segment(1) == PANEL_URL) {
            $main_dir = 'panel/';
        }

        echo $CI->load->view($main_dir . 'layout/navigator');
    }

}

// ------------------------------------------------------------------------

/**
 * Page Content Footer
 *
 * Load content footer for the page
 */
if (!function_exists('load_footer')) {

    function load_footer() {
        $CI = & get_instance();
        $main_dir = 'public/';
        if ($CI->uri->segment(1) == PANEL_URL) {
            $main_dir = 'panel/';
        }

        echo $CI->load->view($main_dir . 'layout/footer');
    }

}

// ------------------------------------------------------------------------

/**
 * Page Navigator
 *
 * Load navigator for the page
 */
if (!function_exists('load_navigator')) {

    function load_footer() {
        $CI = & get_instance();
        $main_dir = 'public/';
        if ($CI->uri->segment(1) == PANEL_URL) {
            $main_dir = 'panel/';
        }

        echo $CI->load->view($main_dir . 'layout/footer');
    }

}

// ------------------------------------------------------------------------

/**
 * Page Slider
 *
 * Load navigator for the page
 */
if (!function_exists('load_slider')) {

    function load_slider() {
        $CI = & get_instance();
        $main_dir = 'public/';
        if ($CI->uri->segment(1) == PANEL_URL) {
            $main_dir = 'panel/';
        }

        echo $CI->load->view($main_dir . 'layout/slider');
    }

}

// ------------------------------------------------------------------------

/**
 * Page Top Navigator
 *
 * Load navigator for the page
 */
if (!function_exists('load_top_navigator')) {

    function load_top_navigator() {
        $CI = & get_instance();
        $main_dir = 'public/';
        if ($CI->uri->segment(1) == PANEL_URL) {
            $main_dir = 'panel/';
        }

        echo $CI->load->view($main_dir . 'layout/top_navigator');
    }

}

// ------------------------------------------------------------------------

/**
 * Application template - Alert message error
 */
if (!function_exists('alert_error')) {
    function alert_error ( $msg, $title = NULL ) {
        $title = ($title == NULL) ? ' error' : $title;
        $msg = fix_lang ($msg);
        $div_f = '<div class="alert alert-danger">';
        $div_s = '</div>';
        return $div_f.$btn_close.'<i class="fa fa-times-circle"></i> '.'<strong>Error!</strong> ' . $msg . $title;
    }

}
// ------------------------------------------------------------------------

/**
 * Application template - Alert message warning
 */
if (!function_exists('alert_warning')) {

    function alert_warning ( $msg, $title = NULL ) {
        $title = ($title == NULL) ? ' warning' : $title;
        $msg = fix_lang ($msg);
        $div_f = '<div class="alert alert-warning">';
        $div_s = '</div>';
        return $div_f.$btn_close.'<i class="fa fa-exclamation-triangle"></i> '.'<strong>Warning!</strong> ' . $msg . $title;
    }

}
// ------------------------------------------------------------------------

/**
 * Application template - Alert message info
 */
if (!function_exists('alert_info')) {

    function alert_info ( $msg, $title = NULL ) {
        $title = ($title == NULL) ? 'Attention' : $title;
        $msg = fix_lang ($msg);
        $div_f = '<div class="alert alert-info">';
        $div_s = '</div>';
        return $div_f.$btn_close.'<i class="fa fa-info-circle"></i> '.'<strong>News!</strong> ' . $msg . $title;
    }

}
// ------------------------------------------------------------------------

/**
 * Application template - Alert message success
 */
if (!function_exists('alert_success')) {


function alert_success ( $msg, $title = NULL ) {
$title = ($title == NULL) ? ' successfull.' : $title;
$msg = fix_lang ($msg);
$div_f = '<div class="alert alert-success">';
$div_s = '</div>';
return $div_f.$btn_close.'<i class="fa fa-check-circle"></i> '.'<strong>Well done!</strong> ' . $msg . $title;
}

}
// ------------------------------------------------------------------------

/**
 * Application template - Alert message block
 */
if (!function_exists('alert_block')) {
function alert_block ( $msg, $title = NULL ) {
$title = ($title == NULL) ? 'Message' : $title;
$msg = fix_lang ($msg);
return "alert-info-- " . $msg . "--" . $title;
}

}
// ------------------------------------------------------------------------
